﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace B2B.Models
{
    public class QuocGia
    {
        int maQuocGia;

        public int MaQuocGia
        {
            get { return maQuocGia; }
            set { maQuocGia = value; }
        }
        string tenQuocGia;

        public string TenQuocGia
        {
            get { return tenQuocGia; }
            set { tenQuocGia = value; }
        }

        public ArrayList DanhSachQuocGia()
        {
            ArrayList list_QuocGia = new ArrayList();
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_DANHSACHQG", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                QuocGia qg = new QuocGia();
                qg.MaQuocGia = reader.GetInt32(0);
                qg.TenQuocGia = reader.GetString(1);
                list_QuocGia.Add(qg);
            }
            conn.Close();
            return list_QuocGia;
        }
    }
}